FC = mpif90

OPTFLAGS = -O2
DEBUGFLAGS =
FCFLAGS = $(OPTFLAGS) $(DEBUGFLAGS) $(F90FLAGS) -warn all -mcmodel large
LFLAGS = -lm
LDFLAGS  = $(LFLAGS) $(LINK_MPIS) -shared-intel
OTHERFLAGS = $(IFLAGS)

SOURCES = nrtype.f90 nrutil.f90 binom.f90 grid.f90 grid_interpolation.f90 parameters.f90 parameters_energy.f90\
functions.f90 \
randu.f90 rouwenhorst.f90 spline_linear_val.f90 lambda0_optimizer.f90 retired_valuer.f90 \
working_valuer.f90 hetero_ss.f90

OBJECTS = $(SOURCES:.f90=.o)
EXEC = transition

%.o: %.f90
	$(FC) $(FCFLAGS) -c $<

all: $(EXEC)

$(EXEC):$(OBJECTS)
	$(FC) $(FCFLAGS) -o $(EXEC) $(OBJECTS) $(LDFLAGS)

clean:
	-$(RM) $(OBJECTS) $(EXEC) *.mod
